cmake_minimum_required(VERSION 3.15)
project(tinkerforge_bindings LANGUAGES C)

file(GLOB TINK_SOURCES ${TINKERFORGE_BINDINGS_SRC_DIR}/source/*.c)
file(GLOB TINK_HEADERS ${TINKERFORGE_BINDINGS_SRC_DIR}/source/*.h)

add_library(${PROJECT_NAME} ${TINK_SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES
    PUBLIC_HEADER "${TINK_HEADERS}"
    WINDOWS_EXPORT_ALL_SYMBOLS ON
)
if(WIN32)
    target_link_libraries(${PROJECT_NAME} PRIVATE ws2_32 advapi32)
endif()

include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
